package com.k.base.jdk.duotai;

import java.util.ArrayList;
import java.util.List;

public class Test {
    private static void testDt(Person p){
        System.out.println(p.getId() +"-"+p.getAge());
        Student zh = (Student) p;
        System.out.println(zh.getId()+"-"+zh.getAge()+"-"+zh.getXh()+"-"+zh.getGrade());
    }
    private static void testDtList(List<Person> list){
        for(Person p:list){
            System.out.println(p instanceof Student);
            Student pu = (Student) p;
            System.out.println("pu-id:"+pu.getId());
            System.out.println("pu-age:"+pu.getAge());

            System.out.println("pu-xh:"+pu.getXh());
            System.out.println("pu-grade:"+pu.getGrade());
        }
    }
    public static void main(String[] args) {
        Student s = new Student();
        s.setId("230111");
        s.setAge(23);
        s.setXh("1");
        s.setGrade(2);
        testDt(s);

//        Student s1 = new Student();
//        s1.setId("230111");
//        s1.setAge(23);
//        s1.setXh("1");
//        s1.setGrade(2);
//        Student s2 = new Student();
//        s2.setId("230112");
//        s2.setAge(24);
//        s2.setXh("1");
//        s2.setGrade(2);
//        List<Person> list = new ArrayList();
//        list.add(s1);
//        list.add(s2);
//        testDtList(list);
    }
}
